home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
steff.hp
< prev
next >
Wrap
Text File
|
1995-03-23
|
4KB
|
46 lines
The following finds a solution to g(x) = x given an initial approximation
p0, using the Steffensen's method.
'G' - this variable must contain the funtion to be evaluated
e.g. 'X^2-2*X+4'
stack levels: 3: initial approximation
2: tolerance level
1: maximum number of iterations before aborting
'STEFF' [ A712 ]
<< 0 -> p0 tol n0 i
<< WHILE i n0 <= REPEAT
p0 'X' STO G EVAL 'p1' STO
p1 'X' STO G EVAL 'p2' STO
p0 p1 p0 - DUP * p2 2 p1 * - p0 + / - 'p' STO
IF p p0 - ABS tol < THEN
p { p X p1 p2 } PURGE ABORT
END
i 1 + 'i' STO
i p p0 - ABS p p 'X' STO G EVAL 4 ->LIST SHON HALT DROP
p 'p0' STO
END
'F'
>>
>>
SHON simply turns shift key on.
SHON
<< # 1F8A7h SYSEVAL >>
At each halt of the program a list containing
- iteration step
- error limit for this guess
- current solution
Simply press CONT to go on to next iteration step.
********************************************************************
* J.J. * JJL101@psuvm.bitnet *
* * Penn State Center for Academic Computing *
* John Lehett * Computational Mathematics *
********************************************************************